from datetime import datetime
from pydantic import BaseModel, ConfigDict, Field
from pydantic.alias_generators import to_camel
from typing import Optional
from module_admin.annotation.pydantic_annotation import as_query




class RagModel(BaseModel):
    """
    知识库信息表对应pydantic模型
    """
    model_config = ConfigDict(alias_generator=to_camel, from_attributes=True)

    id: Optional[int] = Field(default=None, description='知识库id')
    rag_title: Optional[str] = Field(default=None, description='知识库名称')
    user_id: Optional[int] = Field(default=None, description='创建用户id')
    sumary: Optional[str] = Field(default=None, description='知识库摘要')
    status: Optional[str] = Field(default=None, description='知识库状态')
    create_time: Optional[datetime] = Field(default=None, description='创建时间')
    create_by: Optional[str] = Field(default=None, description='创建人')
    update_time: Optional[datetime] = Field(default=None, description='更新时间')
    update_by: Optional[str] = Field(default=None, description='更新人')






class RagQueryModel(RagModel):
    """
    知识库信息不分页查询模型
    """

    begin_time: Optional[str] = Field(default=None, description='开始时间')
    end_time: Optional[str] = Field(default=None, description='结束时间')


@as_query
class RagPageQueryModel(RagQueryModel):
    """
    知识库信息分页查询模型
    """

    page_num: int = Field(default=1, description='当前页码')
    page_size: int = Field(default=10, description='每页记录数')


class DeleteRagModel(BaseModel):
    """
    删除知识库信息模型
    """

    model_config = ConfigDict(alias_generator=to_camel)

    ids: str = Field(description='需要删除的知识库id')
